import { defHttp } from '@/utils/http/axios';


enum Api {
  url = 'Users',
  passWordChange = 'Users/Password/Change'
}

export function list(params) {
  return defHttp.get({ url: Api.url, params });
}
export function info(id) {
  return defHttp.get({ url: Api.url + "/" + id });
}
export function add(data) {
  return defHttp.post({ url: Api.url, data });
}
export function edit(id: string, data) {
  return defHttp.put({ url: Api.url + '/' + id, data });
}
export function editPassword(data) {
  return defHttp.put({ url: Api.passWordChange, data });
}
export function del(id) {
  return defHttp.delete({ url: Api.url, data: id });
}
export function orglist() {
  return defHttp.get({ url: Api.url });
}
export function resetPassWord(id) {
  return defHttp.put({ url: `/Users/Password/Reset/${id}` });
}
export function getChildren(id) {
  return defHttp.get({ url: `Organizations/Tree/${id}` });
}
export function saveOrUpdateMenu(params, isUpdate) {
  const type = isUpdate ? edit(params.id, params) : add(params);
  return type;
}
